package grest.controller;

import java.awt.*;
import java.awt.event.*;
import java.beans.PropertyChangeListener;
import javax.swing.*;
import grest.view.*;
import grest.model.*;
/**
 *
 * @author Agustin
 */
public class CntrlrFormAdmin implements ActionListener {
    private FormAdmin formAct = null;
    
    
    public CntrlrFormAdmin(FormAdmin form){
        formAct = form;
    }
    
    
  //  @Override
   public void actionPerformed(ActionEvent e) {  //captura evento presion botones
        if ( e.getSource() == formAct.getButton(FormAdmin.SALON) ) { //boton SALON
            changeCardForm(FormAdmin.SALON);
        } else if (e.getSource() == formAct.getButton(FormAdmin.RESERVAS) ) { //boton RESERVAS
            changeCardForm(FormAdmin.RESERVAS);
        } else if (e.getSource() == formAct.getButton(FormAdmin.MOZOS) ) {  //boton MOZOS
            changeCardForm(FormAdmin.MOZOS);
        } else if (e.getSource() == formAct.getButton(FormAdmin.MESAS) ) {  //boton MESAS
            changeCardForm(FormAdmin.MESAS);
        } else if (e.getSource() == formAct.getButton(FormAdmin.CLIENTES) ) {  //boton CLIENTES 
            changeCardForm(FormAdmin.CLIENTES);
        } else if (e.getSource() == formAct.getButton(FormAdmin.ESTADISTICAS) ) {  //boton ESTADISTICAS
            changeCardForm(FormAdmin.ESTADISTICAS);
        } else if (e.getSource() == formAct.getButton(FormAdmin.CONFIGURACION) ) {  //boton CONFIGURACION
            changeCardForm(FormAdmin.CONFIGURACION);
        } else if (e.getSource() == formAct.getButton(FormAdmin.PRODUCTOS) ) {  //boton PRODUCTOS
            changeCardForm(FormAdmin.PRODUCTOS);
        } else if (e.getSource() == formAct.getButton(FormAdmin.SALIR) ) {  //boton SALIR
            exitApp();
        }
   }
    
   
   public void changeCardForm(String s){
           formAct.setVistaActual(s);
   }
   
   public void exitApp(){
       System.exit(0);
   }

}